import Vue from 'vue'
import App from './App.vue'
import router from './router'

Vue.config.productionTip = false

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI)

import './styles/index.scss'

import axios from 'axios'
axios.defaults.baseURL = 'http://localhost:8888/api/private/v1/'

axios.interceptors.request.use(config=>{
  let token = localStorage.getItem('mytoken')
  if(token){
    config.headers['Authorization'] = token 
  }
  return config 
},error=>Promise.reject(error))

Vue.prototype.$http = axios

import store from './store.js'

new Vue({
  router,
  render: h => h(App),
  store
}).$mount('#app')
